package com.fastjrun.eladmin.itrms.mapstruct;

import com.fastjrun.eladmin.itrms.domain.SERVER_STATUS;
import com.fastjrun.eladmin.itrms.domain.SERVER_TYPE;
import com.fastjrun.eladmin.itrms.dto.ServerDTO;
import com.fastjrun.eladmin.itrms.entity.RmsServer;
import com.fastjrun.eladmin.itrms.vo.ServerVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.util.List;

public abstract class RmsServerMapperDecorator implements RmsServerMapper {

    @Autowired
    @Qualifier("delegate")
    private RmsServerMapper delegate;

    @Override
    public ServerVO toVO(RmsServer entity) {
        ServerVO serverVO=delegate.toVO(entity);
        serverVO.setServerTypeValue(SERVER_TYPE.getValue(entity.getServerType()));
        serverVO.setStatusValue(SERVER_STATUS.getValue(entity.getStatus()));
        return serverVO;
    }

    @Override
    public List<ServerVO> toVO(List<RmsServer> entityList) {
        return delegate.toVO(entityList);
    }

    @Override
    public RmsServer toEntity(ServerDTO dto) {
        return delegate.toEntity(dto);
    }
}
